@extends('common.base-master')

@section('html-head')
    <link href="{{url('css/admin/pagenum.css')}}" rel="stylesheet" />
    <script src="{{url('/js/lib/jquery.form.js')}}"></script>
    <link href="{{url('css/jquery.form.css')}}" type="text/css" rel="stylesheet" />

    <style>
        .btn_add_classify{
            background: #31bcd3;margin-left:10px;height: 8px;width: 200px;color: white;text-align: center;
            padding: 5px 20px 5px 20px;border-radius:7px;box-shadow: 3px 2px 9px #888888;
        }
    </style>
@endsection

@section('html-body')
<div class="banner_s"><img src="{{asset('Assets/upload/banner_a.jpg')}}" alt=""/></div>
<div class="pst_bg">
	<div class="pst">
    	您当前的位置：
        <span>联系我们</span>>
        <span>在线留言</span>
    </div>
</div>
<div class="scd clearfix">
	<div class="scd_l">
    	<div class="s_name">
        	<img src="{{asset('Assets/images/t4.png')}}" width="150" height="48" alt=""/>
            <i>&nbsp;</i>
        </div>
        <ul class="s_nav">
        	<li><a href="{{route('Home.Index.contact')}}">联系我们</a></li>
            <li class="now"><a href="{{route('Home.Index.book')}}">在线留言</a></li>
        </ul>
    </div>
    <div class="scd_r">
    	<div class="r_name"><span>在线留言</span></div>
        <div class="book_m clearfix">
            <ul>
                <li>
                    <span class="name">姓名：</span>
                    <input name="nickname" type="text" id="nickname">
                </li>
                <li>
                    <span class="name">手机号：</span>
                    <input name="tel" type="text" id="phone">
                </li>
                <li>
                    <span class="name">公司名称：</span>
                    <input name="company" type="text" id="company">
                </li>
                <li>
                    <span class="name">联系邮箱：</span>
                    <input name="email" type="text" id="email">
                </li>
                <li>
                    <span class="name">主题：</span>
                    <input name="title" type="text" id="title">
                </li>
            </ul>
            <ul>
                <li>
                    <span class="name">留言内容：<i>(*必填)</i></span>
                    <textarea name="content" cols="" rows="" id="content"></textarea>
                </li>
                <li>
                    <span class="name">&nbsp;</span>
                    <a href="javascript:;" id="btn-set" class="btn_add_classify">发送</a>
                </li>
            </ul>
        </div>
    </div>
</div>

<script>
    $(function() {
        $(document).on('click', '#btn-set', function () {
            var nickname    = $('#nickname').val();
            var phone       = $('#phone').val();
            var company     = $('#company').val();
            var email       = $('#email').val();
            var title       = $('#title').val();
            var content     = $('#content').val();

            $.ajax({
                url: '{{route("Api.Auth.buildOnlineMessage")}}',
                type: 'post',
                dataType: 'json',
                data: {
                    nickname: nickname,
                    phone: phone,
                    company: company,
                    email: email,
                    title: title,
                    type:'zh',
                    content: content
                },
                success: function (obj) {
                    if (obj.level == "success") {
                        noty({
                            text: obj.message, type: obj.level, timeout: 600,
                            callback: {
                                afterClose: function () {
                                    window.location.reload();
                                }
                            }
                        });
                    } else if (obj.level == "error") {
                        noty({text: obj.message, type: obj.level, timeout: 600});
                    }

                },
                error: function (obj) {
                    console.log(obj);
                }
            });
        });
    });
</script>
@endsection

